package cn.change360.newappchildrenenglish.utils;

import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by Jacky on 2015/11/12.
 */
public class FileUtil {
    /**
     * 从Assets中读取图片
     */
    public static Bitmap getImageFromAssetsFile(Context content, String fileName) {
        Bitmap image = null;
        AssetManager am = content.getResources().getAssets();
        try {
            InputStream is = am.open(fileName);
            image = BitmapFactory.decodeStream(is);
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return image;

    }
}
